package com.gxc.test;

import java.util.Arrays;

/**
 * @author GongXincheng
 * @since 2019-08-10 11:35
 */
public class PaiXu {

    public static void main(String[] args) {

        int[] arr = new int[]{10, -19, 100, 44, 23, -78};


//        for (int i = 0; i < arr.length - 1; i++) {
//            for (int j = i; j < arr.length - 1; j++) {
//                if (arr[j] > arr[j+1]) {
//                    int temp = arr[j];
//                    arr[j] = arr[j+1];
//                    arr[j+1] = temp;
//                }
//            }
//        }


//        for (int i = 0; i < arr.length - 1; i++) {
//            for (int j = i + 1; j < arr.length; j++) {
//                if (arr[i] > arr[j]) {
//                    int temp = arr[i];
//                    arr[i] = arr[j];
//                    arr[j] = temp;
//                }
//            }
//        }


        for (int i = 0; i < arr.length - 1; i++) {
            for (int j = 0; j < arr.length - i - 1; j++) {
                if (arr[j] > arr[j+1]) {
                    int temp = arr[j+1];
                    arr[j+1] = arr[j];
                    arr[j] = temp;
                }
            }
        }

        System.out.println(Arrays.toString(arr));


        String isRepeat = "";
        int length = isRepeat.split(",").length;
        System.out.println(length);

    }

}
